import Personnel.*;
import Class.ClassMate;

import java.util.Scanner;

public class Main {
    public String retName;
    public static Personnel login() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入你的姓名");
        String name = scanner.nextLine();
        System.out.println("请输入你的身份：1代表教师 2代表学生");
        int choice = scanner.nextInt();

        while (true) {
            if (choice == 1) {
                return new Teacher(name);
            } else if (choice == 2) {

                System.out.println("请输入你的年龄");
                int age = scanner.nextInt();
                System.out.println("请输入你的身高");
                Double height = scanner.nextDouble();
                System.out.println("请输入你的成绩");
                int grade = scanner.nextInt();
                return new Student(name, age, height, grade);
            } else {
                System.out.println("输入错误 请重新输入");
                continue;
            }
        }
    }

    public static void main(String[] args) {
        ClassMate classMate = new ClassMate();
        Personnel personnel = login();
//        if(personnel instanceof Student){
//            ClassMate classmate = new ClassMate();
//            Student student = (Student) personnel;
//            classmate.setRetStudent(student);
//        }
        while (true) {
            int choice = personnel.menu();
            personnel.doOperation(choice,classMate);
        }
    }
}
